package by.grsu.transport.model;

import java.sql.Date;

public class User {

	private int id;
	private String name;
	private Role role;
	private String login;
	private String password;
	private Date registrationDate;
	private Boolean isLocked;

	public enum Role {
		ADMIN, DRIVER, PASSENGER;

		public String getValue() {
			return this.name();
		}

		public int getOrdinal() {
			return this.ordinal() + 1;
		}

		public static Role valueOf(int ordinal) {
			String role = null;
			for (Role x : Role.values()) {
				if (x.getOrdinal() == ordinal)
					role = x.name();
			}
			return Role.valueOf(role);
		}
		
		
	}

	public User() {
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public Date getRegistrationDate() {
		return registrationDate;
	}

	public void setRegistrationDate(Date registrationDate) {
		this.registrationDate = registrationDate;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Boolean getIsLocked() {
		return isLocked;
	}

	public void setIsLocked(Boolean isLocked) {
		this.isLocked = isLocked;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

}
